package com.chang.impl;

import java.util.Iterator;

/**
 * @program: StudentIterator
 * @description: 具体迭代器
 * @author: chang
 * @create: 2024-12-30 11h
 **/

public class ClassRoomIterator implements Iterator {
    private ClassRoom room;
    private int index=0;

    public ClassRoomIterator(ClassRoom room) {
        this.room = room;
    }

    @Override
    public boolean hasNext() {
        return index<room.size();
    }

    @Override
    public Object next() {
        return room.get(index++);
    }
}
